#pragma once

#include "sprite2d.h"

namespace teflon
{
    struct AnimatedSprite : public Sprite
    {
        uint32_t size_x = 1;
        uint32_t size_y = 1;
        glm::vec4 uv = glm::vec4(0.0f, 0.0f, 1.0f, 1.0f);
        std::shared_ptr<Texture2D> texture;
        float fps = 1.0f;
        float time_elapsed = 0.0f;

    public:
        AnimatedSprite() {}
        AnimatedSprite(glm::vec2& pos, glm::vec2& size, const std::string& image_path, 
            uint32_t xcount, uint32_t ycount = 1, float fps = 1);
        void Update(float delta_t);

        uint32_t NumIndices() const { return 6; }
        uint32_t NumVertices() const { return 4; }

    private:
        glm::vec4 GetUV(uint32_t index);
    };
}
